import {createRouter, createWebHistory} from 'vue-router'
import login from '@/views/login/index.vue'
import layout from '@/views/layout/index.vue'
import home from '@/views/home/index.vue'
import category from '@/views/category/index.vue'

// 创建router实例对象
const router = createRouter({
    // 创建history模式的路由
    history : createWebHistory(import.meta.env.BASE_URL),
    // path和component对应关系的位置
    routes : [{
        path : '/',
        component : layout,
        children : [{
            path : '',
            component : home
        }, {
            path : 'category',
            component : category
        }]
    }, {
        path : '/login',
        component : login
    }]
})

export default router